<include file="Common/works/search_header" />

<script>
	function show(obj, id) {
		var objDiv = $("#" + id + "");
		$(objDiv).css("display", "block");
	}
	function hide(obj, id) {
		var objDiv = $("#" + id + "");
		$(objDiv).css("display", "none");
	}
</script>
<div class="main" id="main">

	<div class="address" style="background-image: none"></div>
	<div class="details" id="tab1">
		<div class="top">
			<div class="left">
				<img src="{$data.service_logo}" title="{$data.services_name}" />
			</div>
			<div class="right">
				<div class="title">{$data.services_name}</div>
				<div class="details">{$data.service_introduction}</div>
				<if condition="$data['tag_string'] neq ''">
	          <?php $tag_list_recommend = explode(',',$data['tag_string']); ?>
	          <!-- 2016-9-2 添加 -->
	          <div class="information label">
	            <foreach name="tag_list_recommend" item="tag_rec" key="tag_rec_key">
	              <if condition="$tag_rec_key lt 3">
	              <div><span>&middot;</span>{$tag_rec}</div>
	              </if>
	            </foreach>
	          </div>
	          <!-- 2016-9-2 添加end -->
	          </if>
				<div class="information">服务商：{$data.service_publisher}</div>
				<div class="information">更新时间：{$data.service_update_time}</div>
				<div class="ul">
					<div class="li">
						<a class="hr">{$data.api_name}</a>
					</div>
					<div class="cls"></div>
				</div>
				<div class="authorizationt">
					<span>*</span>提示：您现在查看的是<span>预览页面</span>
				</div>
			</div>
		</div>
		<div class="cls"></div>
		<div class="middle">
			<a id="parent_con_one_1" onclick="setTab('con_one_1')" title="api"
				class="hr">API</a><a id="parent_con_one_2"
				onclick="setTab('con_one_2')" title="错误代码参照">错误代码参照</a>
		</div>
		<div class="tail" id="tail">
			<div class="right" id="con_one_1">
				<div class="wz">
					<strong>API名称:</strong>{$data.api_name}
				</div>
				<div class="wz">
					<strong>API介绍:</strong>{$data.api_introduction}
				</div>
				<div class="wz">
					<strong>数据更新类型:</strong>
					<!-- 二选一 -->
					<if condition="$data.api_update_type eq 1"> <a
						class="real_time">实时更新</a> <elseif
						condition="$data.api_update_type eq 2" /> <a class="static_data">静态数据</a>
					</if>
					<!-- 二选一end -->
				</div>
				<div class="wz">
					<strong>收费类型:</strong>
					<!-- 二选一 -->
					<if condition="$data.api_is_charge eq 0"> 
					免费 <elseif
						condition="$data.api_is_charge eq 1" /> 收费
					</if>
					<!-- 二选一end -->
				</div>				
				<div class="wz">
					<strong>接口地址:</strong>https://api.37degree.com/open/{$data.service_name_en}/{$data.api_name_en}
				</div>

				<div class="lbk">
					<div class="wzz">请求示例:</div>
					<div class="lb">
						<textarea class="textarea1" autocomplete="on" readonly="readonly" />
curl '{$data.api_sample_url}' -H 'Authorization:Basic base64_encryption(email:token)'
						</textarea>
						<div class="fieldd">使用HTTP Basic Authentication方式做访问授权,HTTP
							Header里加一个字段(Key/Value对) Authorization: Basic
							base64_auth_string，其中 base64_auth_string 的生成算法为:
							base64(eamil:token) 即用email加上冒号, 加上token拼接起来, 再做base64编码转换。</div>
					</div>
					<div class="cls"></div>
				</div>

				<if condition="$data.api_request_method eq 0">
				<div class="wz">
					<strong>请求方式:</strong>GET/POST
				</div>
				<elseif condition="$data.api_request_method eq 1" />
				<div class="wz">
					<strong>请求方式:</strong>POST
				</div>
				<elseif condition="$data.api_request_method eq 2" />
				<div class="wz">
					<strong>请求方式:</strong>GET
				</div>
				</if>

				<div class="wz">
					<strong>返回格式:</strong>{$data.api_result_format}
				</div>
				<div class="wzz">授权方式:</div>
				<div class="wz wzkd">
					<span>{$data.api_authorized_type}</span>
				</div>

				<if condition="empty($data['service_request_heads']) neq true">
				<div class="lbk">
					<div class="wz none">
						<strong class="service">http请求头</strong>(Request Headers)：
					</div>

					<div class="table-responsive wzkd">
						<table class="table table-bordered table-striped">
							<colgroup>
								<col class="col-xs-3">
								<col class="col-xs-3">
							</colgroup>
							<thead>
								<tr>
									<th class="text-left">参数</th>
									<th class="text-left">值</th>
								</tr>
							</thead>

							<tbody>
								<!-- 循环go -->
								<foreach name="data.service_request_heads" item="value" key="key">
								<tr>
									<td>{$value.name}</td>
									<td>{$value.value}</td>
								</tr>
								</foreach>
								<!-- 循环end -->
							</tbody>
						</table>
					</div>
					<div class="cls"></div>
				</div>
				</if>

				<if condition="empty($data['service_response_heads']) neq true">
					<div class="lbk">
         			 <div class="wz none"><strong class="service">http响应头</strong>(Response Headers)：</div>
		  
                        <div class="table-responsive wzkd">
            			<table class="table table-bordered table-striped">
              			<colgroup>
              			<col class="col-xs-3">
              			<col class="col-xs-3">
            			  </colgroup>
             		    <thead>
               			 <tr>
          				    <th class="text-left">参数</th>
              			    <th class="text-left">值</th>
            			 </tr>
          			    </thead>
              
          			    <tbody>
          			  <!-- 循环go -->
         			    <foreach name="data.service_response_heads" item="value" key="key">
						  <tr>
                  		  <td>{$value.name}</td>
                 		  <td>{$value.value}</td>
               			  </tr>
              		    </foreach>
           			 <!-- 循环end --> 
           			 </tbody>
           			 </table>
                     </div>
                  <div class="cls"></div>
                </div>				
				</if>

				<if condition="empty($data['api_request_param']) neq true">
				<div class="lbk" id="lbkone">
					<div class="wzz">请求参数:</div>
					<div class="lb">
						<div class="table-responsive">
							<table class="table table-bordered table-striped">
								<colgroup>
									<col class="col-xs-2">
									<col class="col-xs-1">
									<col class="col-xs-1">
									<col class="col-xs-2">
									<col class="col-xs-4">
								</colgroup>
								<thead>
									<tr>
										<th class="text-left">参数名</th>
										<th class="text-left">类型</th>
										<th class="text-left">是否必填</th>
										<th class="text-left">示例默认值</th>
										<th class="text-left">说明</th>
									</tr>
								</thead>

								<tbody>
									<foreach name="data.api_request_param" item="value" key="key">
									<tr>
										<td>{$value.name}</td>
										<td>{$value.type}</td>
										<if condition="$value.mast eq 0">
										<td><code>否</code></td>
										<elseif condition="$value.mast eq 1" />
										<td><code>是</code></td>
										<else />
										<td><code>是</code></td>
										</if>

										<td>{$value.default_value}</td>
										<td class="pr"><div class="text-overflow-fix w3">{$value.desc}</div>
											<a data-show-intro="" class="text-overflow-fix"><span>展开</span><i
												class="ml5 caret caret-b-9b caret-down"></i></a></td>
									</tr>
									</foreach>
								</tbody>
							</table>
						</div>
						<!-- 循环end -->

					</div>
					<div class="cls"></div>
				</div>
				</if>

				<if condition="empty($data['api_result_field']) neq true">
				<div class="lbk">
					<div class="wzz">返回字段:</div>
					<div class="lb">
						<div class="table-responsive">
							<table class="table table-bordered table-striped">
								<colgroup>
									<col class="col-xs-3">
									<col class="col-xs-3">
									<col class="col-xs-4">
								</colgroup>
								<thead>
									<tr>
										<th class="text-left">字段名</th>
										<th class="text-left">类型</th>
										<th class="text-left">说明</th>
									</tr>
								</thead>

								<tbody>
									<foreach name="data.api_result_field" item="value" key="key">
									<tr>
										<td>{$value.name}</td>
										<td>{$value.type}</td>
										<td class="pr"><div class="text-overflow-fix w3">{$value.desc}</div>
											<a data-show-intro="" class="text-overflow-fix"><span>展开</span><i
												class="ml5 caret caret-b-9b caret-down"></i></a></td>
									</tr>
									</foreach>
								</tbody>
							</table>
						</div>
					</div>
					<div class="cls"></div>
				</div>
				</if>

				<div class="wz none">
					<strong>JSON返回示例:</strong>
				</div>
				<textarea class="nrtextarea _json_text" disabled="disabled">{$data.api_result_sample}</textarea>
			</div>
			<div class="right" id="con_one_2" style="display: none">
				<!-- 错误代码 -->
				<if condition="empty($data['api_error_codes']) neq true">
				<div class="lbk none">
					<div class="wzz">错误代码:</div>
					<div class="lb">
						<div class="table-responsive">
							<table class="table table-bordered table-striped">
								<colgroup>
									<col class="col-xs-3">
									<col class="col-xs-3">
									<col class="col-xs-4">
								</colgroup>
								<thead>
									<tr>
										<th class="text-left">错误码</th>
										<th class="text-left">错误码返回</th>
										<th class="text-left">说明</th>
									</tr>
								</thead>

								<tbody>
									<!-- 循环go -->
									<foreach name="data.api_error_codes" item="value" key="key">
									<tr>
										<td>{$value.code}</td>
										<td>{$value.info}</td>
										<td class="pr"><div class="text-overflow-fix w3">{$value.desc}</div>
											<a data-show-intro="" class="text-overflow-fix"><span>展开</span><i
												class="ml5 caret caret-b-9b caret-down"></i></a></td>
									</tr>
									</foreach>
								</tbody>
							</table>
						</div>
					</div>
					<div class="cls"></div>
				</div>
				</if>
				<!-- 错误代码 end -->

			</div>
			<div class="cls"></div>
		</div>
		<script type="text/javascript">
			function setTab(name, cursel) {
				$('#con_one_1').hide();
				$('#con_one_2').hide();

				$('#parent_con_one_1').removeClass("hr");
				$('#parent_con_one_2').removeClass("hr");

				$("#" + name).show();
				$("#parent_" + name).addClass("hr");
			}
		</script>
	</div>
</div>
<div class="cls"></div>
<script language="javascript" type="text/javascript"
	src="__PUBLIC__/js/static.js"></script>
<script language="javascript" type="text/javascript"
	src="__PUBLIC__/js/api.js"></script>
<script type="text/javascript">
	!function() {
		require.async([ "apiservice:api.js" ], function(mod) {
			mod.init();
		});
	}();
</script>
</body>
</html>
